package com.inspur.cloud.controller;

import com.inspur.cloud.entity.dataspace.ao.common.HomeAO;
import com.inspur.cloud.entity.dataspace.common.OpEntityResult;
import com.inspur.cloud.service.dataspace.HomeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.security.RolesAllowed;

@RestController
@RequestMapping("/dataspace/api/v1/home")
@Api(value = "home", description = "首页")
public class HomeController {

    @Autowired
    private HomeService homeService;

    @GetMapping
    @ApiOperation(value = "获取首页信息", notes = "对接人：soff")
    @RolesAllowed({"Admin", "Tenant"})
    public OpEntityResult<HomeAO> home() {
        OpEntityResult<HomeAO> result = new OpEntityResult();
        result.setData(homeService.home());
        result.setMsg("查询成功");
        result.setCode(1);
        return result;
    }
}
